import { createSlice } from "@reduxjs/toolkit";
const searchFormSlice = createSlice({
    name: 'searchForm',
    initialState: {
        gender: '',
        birthday: { min: '', max: '' },
        regOrigin: '',
        regTime: { min: '', max: '' },
        memberState: '',
        consumeMoney: { min: '', max: '' }, //累计消费金额
        consumeTimes: { min: '', max: '' },   //累计消费次数
        lastConsumeDate: { min: '', max: '' }, //最近消费日期
        status: '',  //微信状态
    },
    reducers: {
        setSearchParam: (state, action) => {
            const { type, data } = action.payload
            console.log(action.payload)
            // 直接做成数据分层，在更新的时候就不用这么臃肿了 
            switch (type) {
                case 'update':
                    return data
            }
        }
    }
})



// Action creators  
export const actions = searchFormSlice.actions
// reducer
export const reducer = searchFormSlice.reducer;

export default searchFormSlice